package com.bs.jianli.util;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 小姚
 * @pakeageName:com.bs.shopping.utils
 * @ClassName:VersionConfig
 * @Descirption:
 * @data 2022/11/18 19:48
 */
@Configuration
public class VersionConfig {
    @Bean
    public MybatisPlusInterceptor
    mybatisPlusInterceptor() {
        //乐观锁配置
        //分页配置
        MybatisPlusInterceptor interceptor = new
                MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new
                PaginationInnerInterceptor(DbType.MYSQL));
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return interceptor;
    }
}
